<%@ include file="/WEB-INF/view/include.jsp"%>
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>
<link rel="stylesheet" type="text/css"
	href='<c:url value="resources/styles/jquery-ui-1.8.2.custom.css"/>'>

<link rel="stylesheet" type="text/css"
	href='<c:url value="resources/styles/jq.grid.styles.css"/>' />


<link rel=stylesheet type=text/css
	href='<c:url value="resources/styles/jquery.alerts.css"/>' />

<link rel=stylesheet type=text/css
	href='<c:url value="resources/styles/jquery.qtip.css"/>' />
<c:choose>
	<c:when
		test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
		<link rel=stylesheet type=text/css
			href='<c:url value="/resources/styles/style_ar.css"/>' />
	</c:when>
	<c:otherwise>
		<link rel=stylesheet type=text/css
			href='<c:url value="/resources/styles/style.css"/>' />	
	</c:otherwise>
</c:choose>

<script type="text/javascript" src='<c:url value="resources/js/common.js"/>'></script>
<script src='<c:url value="resources/js/jquery-1.6.2.js"/>'></script>
<script src='<c:url value="resources/js/jquery.bgiframe.js"/>'></script>
<script src='<c:url value="resources/js/ui/jquery.ui.core.js"/>'></script>
<script language="Javascript"
	src='<c:url value="/resources/js/ui/jquery-ui-1.8.10.custom.min.js"/>'></script>

<script type="text/javascript"
	src='<c:url value="resources/js/scriptbreaker-multiple-accordion-1.js"/>'></script>

<script type="text/javascript"
	src='<c:url value="resources/js/jquery.pngFix.js"/>'></script>
	
<script language="Javascript"
	src='<c:url value="/resources/js/jquery.url.js"/>'></script>
	
<script language="Javascript" charset="utf-8"
	src='<c:url value="resources/js/validation/jquery.validate.1.9.min.js"/>'></script>

<c:choose>
	<c:when
		test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
		<script language="Javascript"
			src='<c:url value="resources/js/validation/localization/messages_ar.js"/>'></script>
		<script language="Javascript"
		src='<c:url value="/resources/js/ui/jquery.ui.datepicker-ar.js"/>'></script>			
	</c:when>
	<c:otherwise>
		<script language="Javascript"
			src='<c:url value="resources/js/validation/localization/messages_en.js"/>'></script>
	</c:otherwise>
</c:choose>	

<script language="Javascript" charset="utf-8" type="text/javascript"
	src='<c:url value="resources/js/jquery.alerts.js"/>'></script>

<script language="Javascript" charset="utf-8"
	src='<c:url value="resources/js/ui/jquery.qtip.js"/>'></script>

</head>

<div class="t_welcome-user-area">
	<p class="t_welcome-txt">
		<span class="t_welcome-blue-txt"></span>
	</p>
	<p class="t_date">
		<span id="timerSpan"></span>
	</p>
</div>
<div class="t_logo-area">
	<img alt="" src='<c:url value="/resources/images/logo.png"/>'
		class="t_logo"> <img alt=""
		src='<c:url value="/resources/images/logo-name.png"/>'
		class="t_logo-txt">
</div>
<div id="menu">
	<ul id="breadcrumb" class="t_breadcrumb-area">
	</ul>
	<ul>
		<li class="t_links-icon"><span id="langSpan"
			style="cursor: pointer;"> <spring:message code="language.ar" />
		</span>
		</li>
		<li class="t_links-icon"><a href="http://www.trakhees.ae/c/document_library/get_file?uuid=10f6c5f2-8c8f-41f5-a3ab-ff869fd095b7&groupId=10136" target="_blank"><spring:message code="label.help" /><img
			alt="" src='<c:url value="/resources/images/help.png"/>' style="vertical-align: top;"></a>
		</li>
	</ul>
</div>
<script type="text/javascript">
	function twoDigitsFormat(num){
		if(num < 10){
			return '0'+num;
		}else{
			return num;
		}
	}
	function getCurrentTime() {
		var date = new Date();
		var hrs = date.getHours();
		var mins = date.getMinutes();
		mins = twoDigitsFormat(mins);
		var locale = $("#langSelect").val();
		//, {dayNames: $.datepicker.regional[locale].dayNames, monthNames: $.datepicker.regional[locale].monthNames }
		if (hrs < 12) {
			return $.datepicker.formatDate('DD, MM dd, yy | ', date) + twoDigitsFormat(hrs)
					+ ':' + mins + ' AM';
		} else {
			if(hrs == 12){
				return $.datepicker.formatDate('DD, MM dd, yy | ', date) + twoDigitsFormat(hrs)
				+ ':' + mins + ' PM';
			}else{
				return $.datepicker.formatDate('DD, MM dd, yy | ', date)
					+ twoDigitsFormat((hrs - 12)) + ':' + mins + ' PM';
			}
		}
	}
	$()
			.ready(
					function() {
						var time = new Date();
						$("#timerSpan").html(getCurrentTime);
						self.setInterval(function() {
							var time = getCurrentTime();
							$("#timerSpan").html(time);
						}, 1000);
						$("#langSpan")
								.click(
										function() {
											if ($("#langSelect").val() == 'ar') {
												$("#langSelect").val('en');
												$("#langSpan")
														.html(
																'<spring:message code="language.en" />');
											} else {
												$("#langSelect").val('ar');
												$("#langSpan")
														.html(
																'<spring:message code="language.en" />');
											}
											$("#langSelect").trigger('change');

										});
						$("#langSelect")
								.val(
										'${requestScope.requestContextAttribute.locale.language}');

						if ($("#langSelect").val() == 'ar') {
							$("#langSpan").html(
									'<spring:message code="language.en" />');
						} else {
							$("#langSpan").html(
									'<spring:message code="language.ar" />');
						}
						$("#langSelect").change(
								function() {
									var currentURL = $.url();
									var urlStr = currentURL.attr('source');
									var currentLang = currentURL.param('lang');
									var selectedLangName = $(
											"#langSelect option:selected")
											.val();
									if (!$.isEmptyObject(currentURL.param())) {
										if (typeof currentLang == "undefined"
												|| currentLang == null) {
											urlStr += "&lang="
													+ selectedLangName;
										} else {
											var re = new RegExp(
													"lang=([a-z]{2})", "g");
											urlStr = urlStr.replace(re, "lang="
													+ selectedLangName);
										}
									} else {
										urlStr += "?lang=" + selectedLangName;
									}

									window.location.replace(urlStr);

								});
						$("input[type=reset]").live("click",function(){
							window.location.href = window.location.href; 		
						});
						$.alerts.overlayColor = 'black';
						$.alerts.overlayOpacity = 0.75;
					});
</script>

<div class="clear"></div>
<div style="display: none;">
	<form action="">
		<select id="langSelect">
			<option id="ar" value="ar">
				<spring:message code="language.ar" />
			</option>
			<option id="en" value="en">
				<spring:message code="language.en" />
			</option>
		</select>
	</form>
</div>



<!--<sec:authorize access="isAuthenticated()">-->
<!--	<div style="float: right;">-->
<!--		<div style="float: left;">&nbsp;</div>-->
<!--		<div style="float: left;"></div>-->
<!--	</div>-->
<!---->
<!--</sec:authorize>-->
